package com.github.sort;

public class SelectionSort {
    private SelectionSort(){}
    public static void selectSort(Comparable[] R){
        for (int i = 0; i < R.length; i++) {
            int min=i;
            for (int j = i+1; j < R.length ; j++) {
                if (less(R[j],R[min])){
                    min=j;
                }
            }
            Comparable temp=R[i];
           R[i]=R[min];
           R[min]=temp;
        }
    }
    private static boolean less(Comparable v,Comparable w){
        return v.compareTo(w)<0;
    }
}
